package com.example.springboothomework.service;

import com.example.springboothomework.common.ImportError;
import com.example.springboothomework.common.ImportResult;
import com.example.springboothomework.common.PageResponse;
import com.example.springboothomework.entity.Employee;
import com.example.springboothomework.entity.dto.EmployeeDTO;
import com.example.springboothomework.entity.query.EmployeeExcelExportQuery;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 员工service接口
 *
 * @author chenjianhao
 * @date 2025/6/6
 *
 */
public interface IEmployeeService {
    /**
     * 添加员工
     * @param employeeDTO
     * @return
     */
    Long save(EmployeeDTO employeeDTO);

    /**
     * 删除员工
     * @param id
     * @return
     */
    void delete(Long id);

    /**
     * 更新员工
     * @param employeeDTO
     * @return
     */
    void update(EmployeeDTO employeeDTO);

    /**
     * 通过id获取员工
     * @param id
     * @return
     */
    Employee info(Long id);

    /**
     * 分页查询员工
     * @param pageNum
     * @param pageSize
     * @param searchKeyword
     * @param companyId
     * @return
     */
    PageResponse<Employee> queryPage(Integer pageNum, Integer pageSize, String searchKeyword, Long companyId);

    /**
     * 导出员工
     * @param employeeExcelExportQuery
     * @param response
     */
    void exportEmployees(EmployeeExcelExportQuery employeeExcelExportQuery,HttpServletResponse response);

    /**
     * 导入员工
     * @param file
     * @return
     */
    ImportResult importEmployees(MultipartFile file);

    /**
     * 导入员工有失败案例时，导出错误数据
     * @param errors
     * @param response
     */
    void exportErrorData(List<ImportError> errors, HttpServletResponse response);
}